<?php
  
  require_once('system/dbConn.php');
  require_once('system/myFunc.php');

  connect();

  if(!empty($_FILES["xx_pic"]["name"])){
  	$xx_pic = uploadfile('xx_pic','./upload/',array('jpg','gif','png'));
  }
  else{
  	$xx_pic='';
  }
  echo $xx_pic;

  $data = array(
		'xx_title' => trim($_POST['xx_title']),  
		'xx_place' => $_POST['xx_place'],
		'xx_intro' => $_POST['xx_intro'],
		'xx_adddate' => $_POST['xx_adddate'],
		'xx_hint' => $_POST['xx_hint'],
		'xx_pic'=>$xx_pic
  	);

  //执行SQL语句
	$result = add('flower',$data);

  if(!$result){
  	echo "添加失败！<br/>";
  	echo "<a href='addflower.php'>返回</a>";	  
  }else{	  
 	echo "添加成功！";
	echo "或返回<a href='admin/flowerList.php'>鲜花列表</a>页面！";	  
  }    
  
?>